import Vue from "vue"
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
	state:{
		token:'',
    openid:'',
		refleshToken:''
	},
	mutations:{
		set_token(state,token){
			state.token=token;
      localStorage.token=token;
		},
    set_openid(state,openid){
      state.openid=openid;
      //sessionStorage.openid=openid;
      localStorage.setItem("openid",openid);
    },
		set_refleshToken(state,refleshToken){
			state.refleshToken=refleshToken;
      localStorage.refleshToken=refleshToken;
		},
		del_token(state){
			state.token='';
      localStorage.removeItem('token');
		},
		del_refleshToken(state){
			state.refleshToken='';
      localStorage.removeItem('refleshToken');
		}
	}
})
